# 单个变量赋值 =
num = 1
print(num)

# 多个变量赋值 =
num1, float1, str1 = 1, 0.5, 'hello world'
print(f"num1 = {num1}, float1 = {float1}, str1 = {str1}")
# error: a, b = 20, 30, 40  报错，因为左右变量的个数和值的个数不对应

# 多变量赋相同值 =
a = b = 10
print(f'a = {a}, b = {b}')
print(a, id(a))
print(b, id(b))  # 内存地址是一样的

# 交换两个变量的值
a, b = 10, 20
print('交换之前:', a, b)
# 交换
a, b = b, a
print('交换之后:', a, b)
